package com.yoyo.itravel.bean;

/**
 * @Description JSON结果响应实体类【主要用于layui结果封装】
 * @Author HZX
 * @Date 2020/6/20 22:41
 * @Version 1.0
 */
public class JsonResult {

    private static final String SUCCESS = "成功";
    private static final String ERROR = "失败";

    /**
     * 响应状态code，因为前台layui默认0为响应成功，所以此处默认为0
     */
    private Integer code = 0;

    /**
     * 数据总条数
     */
    private Integer count = 0;

    /**
     * 返回是否成功
     */
    private Boolean flag = false;

    /**
     * 返回提示信息
     */
    private String msg = "";

    /**
     * 返回数据信息
     */
    private Object data;

    public JsonResult() {
    }

    public JsonResult(Integer code, Integer count, Boolean flag, String msg, Object data) {
        this.code = code;
        this.count = count;
        this.flag = flag;
        this.msg = msg;
        this.data = data;
    }

    public static String getSUCCESS() {
        return SUCCESS;
    }

    public static String getERROR() {
        return ERROR;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Boolean getFlag() {
        return flag;
    }

    public void setFlag(Boolean flag) {
        this.flag = flag;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    @Override
    public String toString() {
        return "JsonResult{" +
                "code=" + code +
                ", count=" + count +
                ", flag=" + flag +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
